//
//  LZSHisRestViewCell.m
//  IOSProject
//
//  Created by Mac on 2018/4/23.
//  Copyright © 2018年 com.linzhisheng. All rights reserved.
//

#import "LZSHisRestViewCell.h"

@interface LZSHisRestViewCell()
@property (nonatomic, strong) UILabel *resLabel;
@property (nonatomic, strong) UILabel *noLabel;
@property (nonatomic, strong) UILabel *dateLabel;
@property (nonatomic, strong) UILabel *exdateLabel;
@property (nonatomic, strong) UILabel *saleLabel;
@property (nonatomic, strong) UILabel *poolLabel;

@property (nonatomic, strong) UILabel *resTextLabel;
@property (nonatomic, strong) UILabel *noTextLabel;
@property (nonatomic, strong) UILabel *dateTextLabel;
@property (nonatomic, strong) UILabel *exdateTextLabel;
@property (nonatomic, strong) UILabel *saleTextLabel;
@property (nonatomic, strong) UILabel *poolTextLabel;


@end

@implementation LZSHisRestViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.resLabel = [self.contentView setuplabelwithfont:[UIFont systemFontOfSize:12] withText:@"开奖结果" withColor:[UIColor lightGrayColor] wihtAlignemt:NSTextAlignmentLeft];
        self.noLabel = [self.contentView setuplabelwithfont:[UIFont systemFontOfSize:12] withText:@"开奖期号" withColor:[UIColor lightGrayColor] wihtAlignemt:NSTextAlignmentLeft];
        self.dateLabel = [self.contentView setuplabelwithfont:[UIFont systemFontOfSize:12] withText:@"开奖日期" withColor:[UIColor lightGrayColor] wihtAlignemt:NSTextAlignmentLeft];
        self.exdateLabel = [self.contentView setuplabelwithfont:[UIFont systemFontOfSize:12] withText:@"兑奖截止日期" withColor:[UIColor lightGrayColor] wihtAlignemt:NSTextAlignmentLeft];
        self.saleLabel = [self.contentView setuplabelwithfont:[UIFont systemFontOfSize:12] withText:@"本期销售额" withColor:[UIColor lightGrayColor] wihtAlignemt:NSTextAlignmentLeft];
        self.poolLabel = [self.contentView setuplabelwithfont:[UIFont systemFontOfSize:12] withText:@"奖池滚存" withColor:[UIColor lightGrayColor] wihtAlignemt:NSTextAlignmentLeft];
        
        
        //
        self.resTextLabel = [self.contentView setuplabelwithfont:[UIFont systemFontOfSize:12] withText:@"开奖结果1" withColor:[UIColor lightGrayColor] wihtAlignemt:NSTextAlignmentLeft];
        self.noTextLabel = [self.contentView setuplabelwithfont:[UIFont systemFontOfSize:12] withText:@"开奖期号1" withColor:[UIColor lightGrayColor] wihtAlignemt:NSTextAlignmentLeft];
        self.dateTextLabel = [self.contentView setuplabelwithfont:[UIFont systemFontOfSize:12] withText:@"开奖日期1" withColor:[UIColor lightGrayColor] wihtAlignemt:NSTextAlignmentLeft];
        self.exdateTextLabel = [self.contentView setuplabelwithfont:[UIFont systemFontOfSize:12] withText:@"兑奖截止1" withColor:[UIColor lightGrayColor] wihtAlignemt:NSTextAlignmentLeft];
        self.saleTextLabel = [self.contentView setuplabelwithfont:[UIFont systemFontOfSize:12] withText:@"本期销售额1" withColor:[UIColor lightGrayColor] wihtAlignemt:NSTextAlignmentLeft];
        self.poolTextLabel = [self.contentView setuplabelwithfont:[UIFont systemFontOfSize:12] withText:@"奖池滚存1" withColor:[UIColor lightGrayColor] wihtAlignemt:NSTextAlignmentLeft];
        [self.contentView addSubview:self.resLabel];
        [self.contentView addSubview:self.noLabel];
        [self.contentView addSubview:self.dateLabel];
        [self.contentView addSubview:self.exdateLabel];
        [self.contentView addSubview:self.saleLabel];
        [self.contentView addSubview:self.poolLabel];
        
        [self.contentView addSubview:self.resTextLabel];
        [self.contentView addSubview:self.noTextLabel];
        [self.contentView addSubview:self.dateTextLabel];
        [self.contentView addSubview:self.exdateTextLabel];
        [self.contentView addSubview:self.saleTextLabel];
        [self.contentView addSubview:self.poolTextLabel];
        
        CGFloat MARGIN = 25;
        CGFloat centerMargin = 20;
        [self.resLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.contentView.mas_top).mas_offset(20);
            make.left.equalTo(self.contentView.mas_left).mas_offset(20);
            
        }];
        
        [self.resTextLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.contentView.mas_top).mas_offset(20);
            make.left.equalTo(self.resLabel.mas_right).mas_offset(MARGIN);
        }];
        
        [self.noLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.contentView.mas_top).mas_offset(20);
            make.left.equalTo(self.contentView.mas_centerX).mas_offset(centerMargin);
        }];
        
        [self.noTextLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.contentView.mas_top).mas_offset(20);
            make.left.equalTo(self.noLabel.mas_right).mas_offset(MARGIN);
        }];
        
        [self.dateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView.mas_left).mas_offset(20);
            make.top.equalTo(self.noLabel.mas_bottom).mas_offset(10);
        }];
        
        [self.dateTextLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.dateLabel.mas_right).mas_offset(MARGIN);
            make.top.equalTo(self.noLabel.mas_bottom).mas_offset(10);
        }];
        
        [self.exdateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.noLabel.mas_bottom).mas_offset(10);
            make.left.equalTo(self.contentView.mas_centerX).mas_offset(centerMargin);
        }];
        
        [self.exdateTextLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.noLabel.mas_bottom).mas_offset(10);
            make.left.equalTo(self.exdateLabel.mas_right).mas_offset(MARGIN);
        }];
        
        [self.saleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView.mas_left).mas_offset(20);
            make.top.equalTo(self.dateLabel.mas_bottom).mas_offset(10);
            make.bottom.equalTo(self.contentView.mas_bottom).mas_offset(-15);
        }];

        [self.saleTextLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.dateLabel.mas_bottom).mas_offset(10);
            make.left.equalTo(self.saleLabel.mas_right).mas_offset(MARGIN);
        }];

        [self.poolLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.exdateLabel.mas_bottom).mas_offset(10);
            make.left.equalTo(self.contentView.mas_centerX).mas_offset(centerMargin);
        }];

        [self.poolTextLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.exdateTextLabel.mas_bottom).mas_offset(10);
            make.left.equalTo(self.poolLabel.mas_right).mas_offset(MARGIN);
        }];
    }
    return self;
}

-(void)setModel:(LZSLotteryRelistModel *)model{
    _model = model;
    
    if (model) {
        self.resTextLabel.text = model.lottery_res;
        self.noTextLabel.text = model.lottery_no;
        self.dateTextLabel.text = model.lottery_date;
        self.exdateTextLabel.text = model.lottery_exdate;
        self.saleTextLabel.text = model.lottery_sale_amount ?model.lottery_sale_amount:@"暂无";
        self.poolTextLabel.text = model.lottery_pool_amount ?model.lottery_pool_amount:@"暂无";
    }

}

-(void)setHistoryModel:(LZSCaipiaoHistoryListModel *)historyModel{
    _historyModel = historyModel;
    self.resLabel.text = @"开奖日期";
    self.noLabel.text = @"期   号";
    self.dateLabel.text = @"开奖号码";
    self.exdateLabel.text = @"参考号";
    self.saleLabel.text = @"销 售 额";
    self.poolLabel.text = @"";
    self.poolLabel.hidden = YES;
    self.poolTextLabel.hidden = YES;
    
    
    if (historyModel) {
        self.resTextLabel.text = historyModel.opendate;
        self.noTextLabel.text = historyModel.issueno;
        self.dateTextLabel.text = historyModel.number;
        self.exdateTextLabel.text = historyModel.refernumber;
        self.saleTextLabel.text = historyModel.saleamount ?historyModel.saleamount:@"暂无";
//        self.poolTextLabel.text = model.lottery_pool_amount ?model.lottery_pool_amount:@"暂无";
    }

}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
